local sk__fengyin = fk.CreateSkill {

  name = "sk__fengyin",

  tags = {  },

}



sk__fengyin:addEffect(fk.DamageCaused, {
  name = "sk__fengyin",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__fengyin.name) and data.to ~= player and data.card and
      ((data.card.trueName == "slash" and player:getMark("sk__fengyin_slash-turn") == 0) or
      (data.card.name == "duel" and player:getMark("sk__fengyin_duel-turn") == 0))
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, sk__fengyin.name, nil, "#sk__fengyin-invoke::"..data.to.id)
  end,
  on_use = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "sk__fengyin_"..data.card.trueName.."-turn", 1)
    local n1 = #table.filter(player:getCardIds("h"), function(id)
      if player:hasSkill("sk__rongzhuang") and #player:getEquipments(Card.SubtypeWeapon) > 0 and
        #player:getEquipments(Card.SubtypeArmor) > 0 then
        return Fk:getCardById(id).color == Card.Red
      else
        return Fk:getCardById(id).suit == Card.Diamond
      end
    end)
    local n2 = #table.filter(data.to:getCardIds("h"), function(id)
      if player:hasSkill("sk__rongzhuang") and #player:getEquipments(Card.SubtypeWeapon) > 0 and
        #player:getEquipments(Card.SubtypeArmor) > 0 then
        return Fk:getCardById(id).color == Card.Red
      else
        return Fk:getCardById(id).suit == Card.Diamond
      end
    end)
    if n1 > 0 then
      player:drawCards(n1, sk__fengyin.name)
    end
    if n2 > 0 then
      data.damage = data.damage + n2
    end
  end,
})

return sk__fengyin